TYPE
CSharpTest.Net
StringConverter.TryParseMethod<TYPE> Delegate
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Utils Namespace : StringConverter.TryParseMethod<TYPE> Delegate

text
value

Glossary Item Box

The delegate type used to try and parse a string

Syntax

Visual Basic (Declaration) 
Public Delegate Function StringConverter.TryParseMethod(Of TYPE)( _
   ByVal text As String, _
   ByRef value As TYPE _
) As Boolean
C# 
public delegate bool StringConverter.TryParseMethod<TYPE>( 
   string text,
   out TYPE value
)

Parameters

text
value

Type Parameters

TYPE

Example

Library/Library.Test/TestStringConvert.cs

C#Copy Code
DateTime date = new DateTime(2000, 1,2,3,4,5,6);
string dt = date.ToString();

StringConverter c = new StringConverter();

Assert.AreNotEqual(dt, c.ToString(date));

c.Add<DateTime>(DateTime.TryParse, delegate(DateTime value) { return value.ToString(); });

Assert.AreEqual(dt, c.ToString(date));
VB.NETCopy Code
Dim [date] As New DateTime(2000, 1, 2, 3, 4, 5, _
    6)
Dim dt As String = [date].ToString()

Dim c As New StringConverter()

Assert.AreNotEqual(dt, c.ToString([date]))

c.Add(Of DateTime)(DateTime.TryParse, Function(value As DateTime) Do
    Return value.ToString()
End Function)

Assert.AreEqual(dt, c.ToString([date]))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys